

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title><g:message code="comment.edit" default="Edit Comment" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}"><g:message code="home" default="Home" /></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="comment.list" default="Comment List" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="comment.new" default="New Comment" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="comment.edit" default="Edit Comment" /></h1>
            <g:if test="${flash.message}">
            <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}" /></div>
            </g:if>
            <g:hasErrors bean="${commentInstance}">
            <div class="errors">
                <g:renderErrors bean="${commentInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${commentInstance?.id}" />
                <g:hiddenField name="version" value="${commentInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="comment"><g:message code="comment.comment" default="Comment" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'comment', 'errors')}">
                                    <g:textArea name="comment" rows="5" cols="40" value="${fieldValue(bean: commentInstance, field: 'comment')}" />

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="answers"><g:message code="comment.answers" default="Answers" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'answers', 'errors')}">
                                    
<ul>
<g:each in="${commentInstance?.answers}" var="answerInstance">
    <li><g:link controller="answer" action="show" id="${answerInstance.id}">${answerInstance?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="answer" params="['comment.id': commentInstance?.id]" action="create"><g:message code="answer.new" default="New Answer" /></g:link>


                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="commentedBy"><g:message code="comment.commentedBy" default="Commented By" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'commentedBy', 'errors')}">
                                    <g:select name="commentedBy.id" from="${User.list()}" optionKey="id" value="${commentInstance?.commentedBy?.id}"  />

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dateCreated"><g:message code="comment.dateCreated" default="Date Created" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'dateCreated', 'errors')}">
                                    <g:datePicker name="dateCreated" value="${commentInstance?.dateCreated}"  />

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="disabled"><g:message code="comment.disabled" default="Disabled" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'disabled', 'errors')}">
                                    <g:checkBox name="disabled" value="${commentInstance?.disabled}" />

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="lastUpdated"><g:message code="comment.lastUpdated" default="Last Updated" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: commentInstance, field: 'lastUpdated', 'errors')}">
                                    <g:datePicker name="lastUpdated" value="${commentInstance?.lastUpdated}"  />

                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'update', 'default': 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'delete', 'default': 'Delete')}" onclick="return confirm('${message(code: 'delete.confirm', 'default': 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
